<template>
	<div class="add_market">
		<header>编辑营销</header>
		<div class="form_contents">
			<div class="market_name common">
				<p style="width:190px;">营销名称：</p>
				<el-input v-model.trim="input1" placeholder="给营销方案起个名字"></el-input>
			</div>
			<div class="upload_img common">
				<p>上传广告图片：</p>
				<div class="up_imgs">
					<img id="showImg" width="94" height="94" :src="editDatas.ACTIVITY_PHOTO" style="cursor:pointer;" alt="" @click.stop='autoClick' />
					<input type="file" @change="onFileChange" style="display:none;" id="upfile" @click.stop='autoClick'> </div>
			</div>
			<div class="sel_store common">
				<p>适用门店：</p>
				<el-select v-model="value1" placeholder="请选择">
					<el-option v-for="item in options1" :key="item.COMP_ID" :label="item.SHOP_NAME" :value="item.COMP_ID"> </el-option>
				</el-select>
			</div>
			<div class="marketType common">
				<p>营销类型：</p>
				<el-select v-model="value2" placeholder="请选择">
					<el-option v-for="item in options2" :key="item.value" :label="item.label" :value="item.value"> </el-option>
				</el-select>
			</div>
			<div class="sel_date common">
				<p>选择有效日期：</p>
				<el-date-picker v-model="value3" type="datetimerange" :picker-options="pickerOptions1" range-separator="~" start-placeholder="开始日期" end-placeholder="结束日期" align="right"> </el-date-picker>
			</div>
			<!--买一送一-->
			<div class="market_act_one" v-if="value2==4180228">
				<div class="first_b common">
					<p>第一杯：</p>
					<el-input style="width:100px;" v-model.trim="editDatas.BUYNUM_1" placeholder="请输入内容"></el-input>
					<img src="../../assets/images/market/plus.png" @click="first_b" alt="" /> </div>
				<div class="second_b common">
					<p>第二杯免费商品：</p>
					<el-input style="width:100px;" v-model.trim="editDatas.BUYNUM_2" placeholder="请输入内容"></el-input>
					<img src="../../assets/images/market/plus.png" @click="second_b" alt="" /> </div>
			</div>
			<!--买二送一-->
			<div class="market_act_two" v-if="value2==4180225">
				<div class="first_b common">
					<p>第一杯：</p>
					<el-input style="width:100px;" v-model.trim="editDatas.BUYNUM_1" placeholder="请输入内容"></el-input>
					<img src="../../assets/images/market/plus.png" @click="first_bb" alt="" /> </div>
				<div class="second_b common">
					<p>第二杯：</p>
					<el-input style="width:100px;" v-model.trim="editDatas.BUYNUM_2" placeholder="请输入内容"></el-input>
					<img src="../../assets/images/market/plus.png" @click="second_bb" alt="" /> </div>
				<div class="third_b common">
					<p>第三杯免费商品：</p>
					<el-input style="width:100px;" v-model.trim="editDatas.BUYNUM_3" placeholder="请输入内容"></el-input>
					<img src="../../assets/images/market/plus.png" @click="third_bb" alt="" /> </div>
			</div>
			<div class="rank common">
				<p>适用等级：</p>
				<el-select v-model="value7" style="width:350px;" multiple placeholder="请选择">
					<el-option v-for="item in options3" :key="item.value" :label="item.label" :value="item.value"> </el-option>
				</el-select>
			</div>
			<div class="times_limit common">
				<p>当天次数限制：</p>
				<el-input-number v-model.trim="value8" controls-position="right" @change="handleChange4" :min="0" :max="99"></el-input-number>
				<span style="margin-left:10px;">次</span>
			</div>
			<div class="market_period common">
				<p>营销周期：</p>
				<el-select v-model="value9" placeholder="请选择">
					<el-option v-for="item in options4" :key="item.value" :label="item.label" :value="item.value"> </el-option>
				</el-select>
			</div>
			<div class="weekdays common">
				<el-checkbox-group v-model="checkboxGroup">
					<el-checkbox-button v-for="weekday in weekdays" :label="weekday" :key="weekday">
						<span v-if="weekday==1">星期一</span>
						<span v-if="weekday==2">星期二</span>
						<span v-if="weekday==3">星期三</span>
						<span v-if="weekday==4">星期四</span>
						<span v-if="weekday==5">星期五</span>
						<span v-if="weekday==6">星期六</span>
						<span v-if="weekday==7">星期日</span>
					</el-checkbox-button>
				</el-checkbox-group>
			</div>
			<div class="buttons common">
				<el-button type="danger" style="background:#e7251a;" @click.native="submits">提交</el-button>
				<el-button @click.native="cancels">取消</el-button>
				<el-button style="border:1px solid #e7251a;color:#e7251a;display:none;">删除</el-button>
			</div>
		</div>
		<!--买一送一 第一杯编辑start -->
		<el-dialog width="80%" title="编辑商品" :visible.sync="editDialog1">
			<el-dialog width="60%" title="添加商品" style="margin:70px auto auto 150px;" :visible.sync="addDialog1" append-to-body>
				<div class="innerDialog">
					<div class="dialog_condition1">
						<span>分类：</span>
						<div class="dialog_select1">
							<el-select v-model="addValue1" clearable placeholder="请选择">
								<el-option v-for="item in addOptions1" :key="item.CLASS_ID" :label="item.CLASS_NAME" :value="item.CLASS_ID"> </el-option>
							</el-select>
						</div>
						<div class="dialog_input1">
							<el-input v-model.trim="addInput1" placeholder="请输入内容"></el-input>
						</div>
					</div>
					<!--添加商品表格-->
					<div class="dialog_table2">
						<el-table v-loading="loading2" :data="datas2" style="width:100%" @selection-change="handleSelectionChange2">
							<el-table-column type="selection" width="50"> </el-table-column>
							<el-table-column prop="SERV_NAME" label="商品名称" width="220"> </el-table-column>
							<el-table-column prop="CLASS_NAME" label="门店名称" width="220">
								<template slot-scope="scope">
									<span>{{shopName1}}</span>
								</template>
							</el-table-column>
							<el-table-column prop="ATTR_LIST" label="规格" width="180">
								<template slot-scope="scope">
									<span v-if="scope.row.ATTR_NAME_LIST.length ==0 ">无规格</span>
									<span v-else>{{scope.row.ATTR_NAME_LIST.join(',')}}</span>
								</template>
							</el-table-column>
							<el-table-column prop="PRICE" label="App售价" width="180"> </el-table-column>
							<el-table-column prop="PRICE" label="Pad售价" width="180"> </el-table-column>
						</el-table>
						<el-pagination @size-change="handleSizeChange2" @current-change="handleCurrentChange2" :current-page="addPage" :page-sizes="[6,8,10]" :page-size="addPageSize" layout="total, sizes, prev, pager, next, jumper" :total="tableDatas2.COUNT"> </el-pagination>
					</div>
					<div class="dialog_btns2">
						<el-button @click.native="addDialog1=false">收起</el-button>
						<el-button type="danger" style="margin-right:30px;background:#e7251a;" @click.native="add2">加入</el-button>
					</div>
				</div>
			</el-dialog>
			<div class="dialog_btns1">
				<el-button type="danger" style="background:#e7251a;" @click="add_goods1">添加商品</el-button>
				<el-button @click="empty_goods1">清空商品</el-button>
			</div>
			<div class="have_add1">
				<p>
					<img src="../../assets/images/market/select2.png" alt="" />
					<span>已选择&nbsp;
						<label>{{tableDatas1.length}}</label>&nbsp;项</span>
				</p>
			</div>
			<!--编辑商品表格-->
			<div class="dialog_table1">
				<el-table :data="tableDatas1" style="width:100%">
					<el-table-column prop="SERV_NAME" label="商品名称" width="300"> </el-table-column>
					<el-table-column prop="CLASS_NAME" label="分类" width="240"> </el-table-column>
					<el-table-column prop="ATTR_LIST" label="规格" width="220">
						<template slot-scope="scope">
							<span v-if="scope.row.ATTR_NAME_LIST.length ==0 ">无规格</span>
							<span v-else>{{scope.row.ATTR_NAME_LIST.join(',')}}</span>
						</template>
					</el-table-column>
					<el-table-column prop="PRICE" label="App售价" width="220"> </el-table-column>
					<el-table-column prop="PRICE" label="Pad售价" width="220"> </el-table-column>
					<el-table-column prop="options" label="操作" width="220">
						<template slot-scope="scope">
							<span class="delete1" @click="editDel(scope.row.SERV_ID,scope.row.CAFEACTIVITYGOODS_ID)">删除</span>
						</template>
					</el-table-column>
				</el-table>
			</div>
			<div class="dialog_footer1">
				<el-button type="danger" style="background:#e7251a;" @click.native="editFinished">完成</el-button>
			</div>
		</el-dialog>
		<!-- 第一杯编辑end -->
		<!--买一送一 第二杯编辑start -->
		<el-dialog width="80%" title="编辑商品" :visible.sync="editDialog11">
			<el-dialog width="60%" title="添加商品" style="margin:70px auto auto 150px;" :visible.sync="addDialog11" append-to-body>
				<div class="innerDialog">
					<div class="dialog_condition1">
						<span>分类：</span>
						<div class="dialog_select1">
							<el-select v-model="addValue11" clearable placeholder="请选择">
								<el-option v-for="item in addOptions11" :key="item.CLASS_ID" :label="item.CLASS_NAME" :value="item.CLASS_ID"> </el-option>
							</el-select>
						</div>
						<div class="dialog_input1">
							<el-input v-model.trim="addInput11" placeholder="请输入内容"></el-input>
						</div>
					</div>
					<!--添加商品表格-->
					<div class="dialog_table2">
						<el-table v-loading="loading11" :data="datas11" style="width:100%" @selection-change="handleSelectionChange11">
							<el-table-column type="selection" width="50"> </el-table-column>
							<el-table-column prop="SERV_NAME" label="商品名称" width="220"> </el-table-column>
							<el-table-column prop="CLASS_NAME" label="门店名称" width="220">
								<template slot-scope="scope">
									<span>{{shopName11}}</span>
								</template>
							</el-table-column>
							<el-table-column prop="ATTR_LIST" label="规格" width="180">
								<template slot-scope="scope">
									<span v-if="scope.row.ATTR_NAME_LIST.length ==0 ">无规格</span>
									<span v-else>{{scope.row.ATTR_NAME_LIST.join(',')}}</span>
								</template>
							</el-table-column>
							<el-table-column prop="PRICE" label="App售价" width="180"> </el-table-column>
							<el-table-column prop="PRICE" label="Pad售价" width="180"> </el-table-column>
						</el-table>
						<el-pagination @size-change="handleSizeChange11" @current-change="handleCurrentChange11" :current-page="addPage11" :page-sizes="[6,8,10]" :page-size="addPageSize11" layout="total, sizes, prev, pager, next, jumper" :total="tableDatas12.COUNT"> </el-pagination>
					</div>
					<div class="dialog_btns2">
						<el-button @click.native="addDialog11=false">收起</el-button>
						<el-button type="danger" style="margin-right:30px;background:#e7251a;" @click.native="add11">加入</el-button>
					</div>
				</div>
			</el-dialog>
			<div class="dialog_btns1">
				<el-button type="danger" style="background:#e7251a;" @click="add_goods11">添加商品</el-button>
				<el-button @click="empty_goods11">清空商品</el-button>
			</div>
			<div class="have_add1">
				<p>
					<img src="../../assets/images/market/select2.png" alt="" />
					<span>已选择&nbsp;
						<label>{{tableDatas11.length}}</label>&nbsp;项</span>
				</p>
			</div>
			<!--编辑商品表格-->
			<div class="dialog_table1">
				<el-table :data="tableDatas11" style="width:100%">
					<el-table-column prop="SERV_NAME" label="商品名称" width="300"> </el-table-column>
					<el-table-column prop="CLASS_NAME" label="分类" width="240"> </el-table-column>
					<el-table-column prop="ATTR_LIST" label="规格" width="220">
						<template slot-scope="scope">
							<span v-if="scope.row.ATTR_NAME_LIST.length ==0 ">无规格</span>
							<span v-else>{{scope.row.ATTR_NAME_LIST.join(',')}}</span>
						</template>
					</el-table-column>
					<el-table-column prop="PRICE" label="App售价" width="220"> </el-table-column>
					<el-table-column prop="PRICE" label="Pad售价" width="220"> </el-table-column>
					<el-table-column prop="options" label="操作" width="220">
						<template slot-scope="scope">
							<span class="delete1" @click="editDel11(scope.row.SERV_ID,scope.row.CAFEACTIVITYGOODS_ID)">删除</span>
						</template>
					</el-table-column>
				</el-table>
			</div>
			<div class="dialog_footer1">
				<el-button type="danger" style="background:#e7251a;" @click.native="editFinished11">完成</el-button>
			</div>
		</el-dialog>
		<!-- 第一杯编辑end -->
		<!--买二送一 第一杯编辑start -->
		<el-dialog width="80%" title="编辑商品" :visible.sync="editDialog22">
			<el-dialog width="60%" title="添加商品" style="margin:70px auto auto 150px;" :visible.sync="addDialog22" append-to-body>
				<div class="innerDialog">
					<div class="dialog_condition1">
						<span>分类：</span>
						<div class="dialog_select1">
							<el-select v-model="addValue22" clearable placeholder="请选择">
								<el-option v-for="item in addOptions22" :key="item.CLASS_ID" :label="item.CLASS_NAME" :value="item.CLASS_ID"> </el-option>
							</el-select>
						</div>
						<div class="dialog_input1">
							<el-input v-model.trim="addInput22" placeholder="请输入内容"></el-input>
						</div>
					</div>
					<!--添加商品表格-->
					<div class="dialog_table2">
						<el-table v-loading="loading22" :data="datas22" style="width:100%" @selection-change="handleSelectionChange22">
							<el-table-column type="selection" width="50"> </el-table-column>
							<el-table-column prop="SERV_NAME" label="商品名称" width="220"> </el-table-column>
							<el-table-column prop="CLASS_NAME" label="门店名称" width="220">
								<template slot-scope="scope">
									<span>{{shopName22}}</span>
								</template>
							</el-table-column>
							<el-table-column prop="ATTR_LIST" label="规格" width="180">
								<template slot-scope="scope">
									<span v-if="scope.row.ATTR_NAME_LIST.length ==0 ">无规格</span>
									<span v-else>{{scope.row.ATTR_NAME_LIST.join(',')}}</span>
								</template>
							</el-table-column>
							<el-table-column prop="PRICE" label="App售价" width="180"> </el-table-column>
							<el-table-column prop="PRICE" label="Pad售价" width="180"> </el-table-column>
						</el-table>
						<el-pagination @size-change="handleSizeChange22" @current-change="handleCurrentChange22" :current-page="addPage22" :page-sizes="[6,8,10]" :page-size="addPageSize22" layout="total, sizes, prev, pager, next, jumper" :total="tableDatas55.COUNT"> </el-pagination>
					</div>
					<div class="dialog_btns2">
						<el-button @click.native="addDialog22=false">收起</el-button>
						<el-button type="danger" style="margin-right:30px;background:#e7251a;" @click.native="add22">加入</el-button>
					</div>
				</div>
			</el-dialog>
			<div class="dialog_btns1">
				<el-button type="danger" style="background:#e7251a;" @click="add_goods22">添加商品</el-button>
				<el-button @click="empty_goods22">清空商品</el-button>
			</div>
			<div class="have_add1">
				<p>
					<img src="../../assets/images/market/select2.png" alt="" />
					<span>已选择&nbsp;
						<label>{{tableDatas22.length}}</label>&nbsp;项</span>
				</p>
			</div>
			<!--编辑商品表格-->
			<div class="dialog_table1">
				<el-table :data="tableDatas22" style="width:100%">
					<el-table-column prop="SERV_NAME" label="商品名称" width="300"> </el-table-column>
					<el-table-column prop="CLASS_NAME" label="分类" width="240"> </el-table-column>
					<el-table-column prop="ATTR_LIST" label="规格" width="220">
						<template slot-scope="scope">
							<span v-if="scope.row.ATTR_NAME_LIST.length ==0 ">无规格</span>
							<span v-else>{{scope.row.ATTR_NAME_LIST.join(',')}}</span>
						</template>
					</el-table-column>
					<el-table-column prop="PRICE" label="App售价" width="220"> </el-table-column>
					<el-table-column prop="PRICE" label="Pad售价" width="220"> </el-table-column>
					<el-table-column prop="options" label="操作" width="220">
						<template slot-scope="scope">
							<span class="delete1" @click="editDel22(scope.row.SERV_ID,scope.row.CAFEACTIVITYGOODS_ID)">删除</span>
						</template>
					</el-table-column>
				</el-table>
			</div>
			<div class="dialog_footer1">
				<el-button type="danger" style="background:#e7251a;" @click.native="editFinished22">完成</el-button>
			</div>
		</el-dialog>
		<!-- 第一杯编辑end -->
		<!--买二送一 第二杯编辑start -->
		<el-dialog width="80%" title="编辑商品" :visible.sync="editDialog33">
			<el-dialog width="60%" title="添加商品" style="margin:70px auto auto 150px;" :visible.sync="addDialog33" append-to-body>
				<div class="innerDialog">
					<div class="dialog_condition1">
						<span>分类：</span>
						<div class="dialog_select1">
							<el-select v-model="addValue33" clearable placeholder="请选择">
								<el-option v-for="item in addOptions33" :key="item.CLASS_ID" :label="item.CLASS_NAME" :value="item.CLASS_ID"> </el-option>
							</el-select>
						</div>
						<div class="dialog_input1">
							<el-input v-model.trim="addInput33" placeholder="请输入内容"></el-input>
						</div>
					</div>
					<!--添加商品表格-->
					<div class="dialog_table2">
						<el-table v-loading="loading33" :data="datas33" style="width:100%" @selection-change="handleSelectionChange33">
							<el-table-column type="selection" width="50"> </el-table-column>
							<el-table-column prop="SERV_NAME" label="商品名称" width="220"> </el-table-column>
							<el-table-column prop="CLASS_NAME" label="门店名称" width="220">
								<template slot-scope="scope">
									<span>{{shopName33}}</span>
								</template>
							</el-table-column>
							<el-table-column prop="ATTR_LIST" label="规格" width="180">
								<template slot-scope="scope">
									<span v-if="scope.row.ATTR_NAME_LIST.length ==0 ">无规格</span>
									<span v-else>{{scope.row.ATTR_NAME_LIST.join(',')}}</span>
								</template>
							</el-table-column>
							<el-table-column prop="PRICE" label="App售价" width="180"> </el-table-column>
							<el-table-column prop="PRICE" label="Pad售价" width="180"> </el-table-column>
						</el-table>
						<el-pagination @size-change="handleSizeChange33" @current-change="handleCurrentChange33" :current-page="addPage33" :page-sizes="[6,8,10]" :page-size="addPageSize33" layout="total, sizes, prev, pager, next, jumper" :total="tableDatas66.COUNT"> </el-pagination>
					</div>
					<div class="dialog_btns2">
						<el-button @click.native="addDialog33=false">收起</el-button>
						<el-button type="danger" style="margin-right:30px;background:#e7251a;" @click.native="add33">加入</el-button>
					</div>
				</div>
			</el-dialog>
			<div class="dialog_btns1">
				<el-button type="danger" style="background:#e7251a;" @click="add_goods33">添加商品</el-button>
				<el-button @click="empty_goods33">清空商品</el-button>
			</div>
			<div class="have_add1">
				<p>
					<img src="../../assets/images/market/select2.png" alt="" />
					<span>已选择&nbsp;
						<label>{{tableDatas33.length}}</label>&nbsp;项</span>
				</p>
			</div>
			<!--编辑商品表格-->
			<div class="dialog_table1">
				<el-table :data="tableDatas33" style="width:100%">
					<el-table-column prop="SERV_NAME" label="商品名称" width="300"> </el-table-column>
					<el-table-column prop="CLASS_NAME" label="分类" width="240"> </el-table-column>
					<el-table-column prop="ATTR_LIST" label="规格" width="220">
						<template slot-scope="scope">
							<span v-if="scope.row.ATTR_NAME_LIST.length ==0 ">无规格</span>
							<span v-else>{{scope.row.ATTR_NAME_LIST.join(',')}}</span>
						</template>
					</el-table-column>
					<el-table-column prop="PRICE" label="App售价" width="220"> </el-table-column>
					<el-table-column prop="PRICE" label="Pad售价" width="220"> </el-table-column>
					<el-table-column prop="options" label="操作" width="220">
						<template slot-scope="scope">
							<span class="delete1" @click="editDel33(scope.row.SERV_ID,scope.row.CAFEACTIVITYGOODS_ID)">删除</span>
						</template>
					</el-table-column>
				</el-table>
			</div>
			<div class="dialog_footer1">
				<el-button type="danger" style="background:#e7251a;" @click.native="editFinished33">完成</el-button>
			</div>
		</el-dialog>
		<!-- 第二杯编辑end -->
		<!--买二送一 第三杯编辑start -->
		<el-dialog width="80%" title="编辑商品" :visible.sync="editDialog44">
			<el-dialog width="60%" title="添加商品" style="margin:70px auto auto 150px;" :visible.sync="addDialog44" append-to-body>
				<div class="innerDialog">
					<div class="dialog_condition1">
						<span>分类：</span>
						<div class="dialog_select1">
							<el-select v-model="addValue44" clearable placeholder="请选择">
								<el-option v-for="item in addOptions44" :key="item.CLASS_ID" :label="item.CLASS_NAME" :value="item.CLASS_ID"> </el-option>
							</el-select>
						</div>
						<div class="dialog_input1">
							<el-input v-model.trim="addInput44" placeholder="请输入内容"></el-input>
						</div>
					</div>
					<!--添加商品表格-->
					<div class="dialog_table2">
						<el-table v-loading="loading44" :data="datas44" style="width:100%" @selection-change="handleSelectionChange44">
							<el-table-column type="selection" width="50"> </el-table-column>
							<el-table-column prop="SERV_NAME" label="商品名称" width="220"> </el-table-column>
							<el-table-column prop="CLASS_NAME" label="门店名称" width="220">
								<template slot-scope="scope">
									<span>{{shopName44}}</span>
								</template>
							</el-table-column>
							<el-table-column prop="ATTR_LIST" label="规格" width="180">
								<template slot-scope="scope">
									<span v-if="scope.row.ATTR_NAME_LIST.length ==0 ">无规格</span>
									<span v-else>{{scope.row.ATTR_NAME_LIST.join(',')}}</span>
								</template>
							</el-table-column>
							<el-table-column prop="PRICE" label="App售价" width="180"> </el-table-column>
							<el-table-column prop="PRICE" label="Pad售价" width="180"> </el-table-column>
						</el-table>
						<el-pagination @size-change="handleSizeChange44" @current-change="handleCurrentChange44" :current-page="addPage44" :page-sizes="[6,8,10]" :page-size="addPageSize44" layout="total, sizes, prev, pager, next, jumper" :total="tableDatas77.COUNT"> </el-pagination>
					</div>
					<div class="dialog_btns2">
						<el-button @click.native="addDialog44=false">收起</el-button>
						<el-button type="danger" style="margin-right:30px;background:#e7251a;" @click.native="add44">加入</el-button>
					</div>
				</div>
			</el-dialog>
			<div class="dialog_btns1">
				<el-button type="danger" style="background:#e7251a;" @click="add_goods44">添加商品</el-button>
				<el-button @click="empty_goods44">清空商品</el-button>
			</div>
			<div class="have_add1">
				<p>
					<img src="../../assets/images/market/select2.png" alt="" />
					<span>已选择&nbsp;
						<label>{{tableDatas44.length}}</label>&nbsp;项</span>
				</p>
			</div>
			<!--编辑商品表格-->
			<div class="dialog_table1">
				<el-table :data="tableDatas44" style="width:100%">
					<el-table-column prop="SERV_NAME" label="商品名称" width="300"> </el-table-column>
					<el-table-column prop="CLASS_NAME" label="分类" width="240"> </el-table-column>
					<el-table-column prop="ATTR_LIST" label="规格" width="220">
						<template slot-scope="scope">
							<span v-if="scope.row.ATTR_NAME_LIST.length ==0 ">无规格</span>
							<span v-else>{{scope.row.ATTR_NAME_LIST.join(',')}}</span>
						</template>
					</el-table-column>
					<el-table-column prop="PRICE" label="App售价" width="220"> </el-table-column>
					<el-table-column prop="PRICE" label="Pad售价" width="220"> </el-table-column>
					<el-table-column prop="options" label="操作" width="220">
						<template slot-scope="scope">
							<span class="delete1" @click="editDel44(scope.row.SERV_ID,scope.row.CAFEACTIVITYGOODS_ID)">删除</span>
						</template>
					</el-table-column>
				</el-table>
			</div>
			<div class="dialog_footer1">
				<el-button type="danger" style="background:#e7251a;" @click.native="editFinished44">完成</el-button>
			</div>
		</el-dialog>
		<!-- 第三杯编辑end -->
	</div>
</template>
<script>
	import axios from 'axios'
	import qs from 'qs'
	import { get4SCafeShopList } from '@/api/market'
	import { getServDetailByCompId } from '@/api/market'
	import { getCafeServSecondClass } from '@/api/market'
	import { addCafeActivity } from '@/api/market'
	import { getCafeActivityInfo } from '@/api/market'
	import { getCafeActivityGoodsByCafeActivityId } from '@/api/market'
	import { deleteCafeActivityGoods } from '@/api/market'
	import dateSelect from '@/assets/js/date_time_picker.js' //日期选择器数据封装
	export default {
		name: 'add_market',
		data() {
			return {
				input1: '', //营销名称
				imageUrl: '', //图片上传地址
				value1: '', //选择门店comp_id      
				shopName1: '', //选择的门店名字
				shopName11: '',
				shopName22: '',
				shopName33: '',
				shopName44: '',
				value2: '', //营销类型
				options1: [],
				options2: [{
					value: 4180228,
					label: '买一送一'
				}, {
					value: 4180225,
					label: '买二送一'
				}],
				value3: [], //有效时间
				pickerOptions1: dateSelect,
				value4: 0, //第一杯
				value5: 0, //第二杯
				value6: 0, //第三杯
				value7: '', //适用等级 1-普通 2-银卡 3-金卡 4-钻石
				options3: [{
					value: 1,
					label: '普通'
				}, {
					value: 2,
					label: '银卡'
				}, {
					value: 3,
					label: '金卡'
				}, {
					value: 4,
					label: '钻石'
				}],
				value8: 0, //当天次数限制
				value9: [], //营销周期，是个数组
				options4: [{
					value: 1,
					label: '按周促销'
				}],
				editDialog1: false, //编辑买一送一第一杯商品的dialog
				editDialog11: false, //编辑买一送一第二杯商品的dialog
				editDialog22: false, //编辑买二送一第一杯商品的dialog
				editDialog33: false, //编辑买二送一第二杯商品的dialog
				editDialog44: false, //编辑买二送一第三杯商品的dialog
				addDialog1: false,
				addDialog11: false,
				addDialog22: false,
				addDialog33: false,
				addDialog44: false,
				tableDatas1: [],
				tableDatas11: [],
				tableDatas22: [],
				tableDatas33: [],
				tableDatas44: [],
				addInput1: '', //添加商品input值
				addInput11: '',
				addInput22: '',
				addInput33: '',
				addInput44: '',
				addValue1: '', //添加商品select值
				addValue11: '',
				addValue22: '',
				addValue33: '',
				addValue44: '',
				addPage: 1,
				addPage11: 1,
				addPage22: 1,
				addPage33: 1,
				addPage44: 1,
				addPageSize: 6,
				addPageSize11: 6,
				addPageSize22: 6,
				addPageSize33: 6,
				addPageSize44: 6,
				addOptions1: [],
				addOptions11: [],
				addOptions22: [],
				addOptions33: [],
				addOptions44: [],
				tableDatas2: [], //添加商品	买一送一第一杯  
				tableDatas12: [], //添加商品 买一送一第二杯 --免费的	 
				tableDatas55: [], //添加商品 买二送一第一杯	 
				tableDatas66: [], //添加商品 买二送一第二杯	 
				tableDatas77: [], //添加商品	买二送一第三杯 --免费的
				loading2: true,
				loading11: true,
				loading22: true,
				loading33: true,
				loading44: true,
				selectArr: [], //已选择的数组集合
				selectArr11: [],
				selectArr22: [],
				selectArr33: [],
				selectArr44: [],
				checkboxGroup: [],
				//weekdays:['1','2','3','4','5','6','7'],
				weekdays: [1, 2, 3, 4, 5, 6, 7],
				imgU: '',
				editDatas: '', //编辑商品的详细信息
			}
		},
		computed: {
			//买一送一 第一杯
			firstCup: function() {
				return this.tableDatas1.length;
			},
			//买一送一 第二杯
			firstCup11: function() {
				return this.tableDatas11.length;
			},
			//买二送一 第一杯
			firstCup22: function() {
				return this.tableDatas22.length;
			},
			//买二送一 第二杯
			firstCup33: function() {
				return this.tableDatas33.length;
			},
			//买二送一 第三杯
			firstCup44: function() {
				return this.tableDatas44.length;
			},
			//添加商品请求参数
			objs1() {
				let obj = {};
				obj.COMP_ID = this.value1;
				this.addInput1 ? obj.SERV_NAME = this.addInput1 : '';
				this.addValue1 ? obj.SECOND_CLASS = Number(this.addValue1) : '';
				obj.PAGE_NO = this.addPage;
				obj.PAGE_SIZE = this.addPageSize;
				return obj;
			},
			objs11() {
				let obj = {};
				obj.COMP_ID = this.value1;
				this.addInput11 ? obj.SERV_NAME = this.addInput11 : '';
				this.addValue11 ? obj.SECOND_CLASS = Number(this.addValue11) : '';
				obj.PAGE_NO = this.addPage11;
				obj.PAGE_SIZE = this.addPageSize11;
				return obj;
			},
			objs22() {
				let obj = {};
				obj.COMP_ID = this.value1;
				this.addInput22 ? obj.SERV_NAME = this.addInput22 : '';
				this.addValue22 ? obj.SECOND_CLASS = Number(this.addValue22) : '';
				obj.PAGE_NO = this.addPage22;
				obj.PAGE_SIZE = this.addPageSize22;
				return obj;
			},
			objs33() {
				let obj = {};
				obj.COMP_ID = this.value1;
				this.addInput33 ? obj.SERV_NAME = this.addInput33 : '';
				this.addValue33 ? obj.SECOND_CLASS = Number(this.addValue33) : '';
				obj.PAGE_NO = this.addPage33;
				obj.PAGE_SIZE = this.addPageSize33;
				return obj;
			},
			objs44() {
				let obj = {};
				obj.COMP_ID = this.value1;
				this.addInput44 ? obj.SERV_NAME = this.addInput44 : '';
				this.addValue44 ? obj.SECOND_CLASS = Number(this.addValue44) : '';
				obj.PAGE_NO = this.addPage44;
				obj.PAGE_SIZE = this.addPageSize44;
				return obj;
			},
			//添加商品列表
			getServData() {
				this.loading2 = true;
				//根据门店唯一标识获取商品列表
				getServDetailByCompId(this.objs1).then(res => {
					if(res.data.STATUS_CODE === 1) {
						this.loading2 = false;
						this.tableDatas2 = res.data;
					}
				})
			},
			getServData11() {
				this.loading11 = true;
				//根据门店唯一标识获取商品列表
				getServDetailByCompId(this.objs11).then(res => {
					if(res.data.STATUS_CODE === 1) {
						//console.log(res.data);					
						this.loading11 = false;
						this.tableDatas12 = res.data;
					}
				})
			},
			getServData22() {
				this.loading22 = true;
				//根据门店唯一标识获取商品列表
				getServDetailByCompId(this.objs22).then(res => {
					if(res.data.STATUS_CODE === 1) {
						//console.log(res.data);					
						this.loading22 = false;
						this.tableDatas55 = res.data;
					}
				})
			},
			getServData33() {
				this.loading11 = true;
				//根据门店唯一标识获取商品列表
				getServDetailByCompId(this.objs33).then(res => {
					if(res.data.STATUS_CODE === 1) {
						//console.log(res.data);					
						this.loading33 = false;
						this.tableDatas66 = res.data;
					}
				})
			},
			getServData44() {
				this.loading44 = true;
				//根据门店唯一标识获取商品列表
				getServDetailByCompId(this.objs44).then(res => {
					if(res.data.STATUS_CODE === 1) {
						//console.log(res.data);					
						this.loading44 = false;
						this.tableDatas77 = res.data;
					}
				})
			},
			//添加分页数据
			datas2() {
				this.getServData;
				if(this.tableDatas2.SERV_LIST) {
					return this.tableDatas2.SERV_LIST;
				}
			},
			datas11() {
				this.getServData11;
				if(this.tableDatas12.SERV_LIST) {
					return this.tableDatas12.SERV_LIST;
				}
			},
			datas22() {
				this.getServData22;
				if(this.tableDatas55.SERV_LIST) {
					return this.tableDatas55.SERV_LIST;
				}
			},
			datas33() {
				this.getServData33;
				if(this.tableDatas66.SERV_LIST) {
					return this.tableDatas66.SERV_LIST;
				}
			},
			datas44() {
				this.getServData44;
				if(this.tableDatas77.SERV_LIST) {
					return this.tableDatas77.SERV_LIST;
				}
			},
		},
		created() {
			//离开页面提醒
        	window.onbeforeunload = function(e) {
                var e = window.event || e;
                e.returnValue = ("在新增或编辑时，关闭选项卡将导致数据无法保存");
            }
			this.getI();
			//获取所有4s咖啡门店
			axios({
				url: window.getIps + '/4SCAFE/CafeActivitySystem/get4SCafeShopList.action',
				method: 'post',
				headers: {
					'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
				},
			}).then(res => {
				//console.log(res)
				this.options1 = res.data.SHOP_LIST;
			})
			//获取咖啡商品二级分类
			getCafeServSecondClass().then(res => {
				//console.log(res);
				if(res.data.STATUS_CODE === 1) {
					this.addOptions1 = res.data.SERVICE_CLASS;
					this.addOptions11 = res.data.SERVICE_CLASS;
					this.addOptions22 = res.data.SERVICE_CLASS;
					this.addOptions33 = res.data.SERVICE_CLASS;
					this.addOptions44 = res.data.SERVICE_CLASS;
				}
			});
		},
		methods: {
			//根据id获取信息
			getI() {
				//--------------------编辑营销start---------------------------
				getCafeActivityInfo(this.$route.params.id).then(res => {
					if(res.data.STATUS_CODE == 1) {
						this.editDatas = res.data;
						this.input1 = this.editDatas.ACTIVITY_NAME; //营销名称
						this.value1 = this.editDatas.COMP_ID; //适用门店comp_id
						this.value2 = this.editDatas.ACT_TYPE; //营销类型 买一送一:4180228   买二送一:4180225		   		
						this.value3.push(new Date(this.editDatas.START_TIME)); //有效日期开始时间
						this.value3.push(new Date(this.editDatas.END_TIME)); //有效日期结束时间
						this.value7 = this.editDatas.USER_GRADE.split(','); //适用等级
						this.value8 = this.editDatas.BUY_NUM; //当天次数限制
						this.value9 = this.editDatas.PERIOD_TYPE; //1-营销周期
						this.checkboxGroup = this.editDatas.WEEK.split(','); //周几
						/* split处理后数组里的值都是字符串，转为数字start */
						this.arrNum(this.value7);
						this.arrNum(this.checkboxGroup);
						/* split处理后数组里的值都是字符串，转为数字end */
					}
					//console.log(this.editDatas);		   	
				})
				//---------------------编辑营销end---------------------------
			},
			handleSizeChange2(val) {
				this.addPageSize = val;
			},
			handleCurrentChange2(val) {
				//console.log(this.selectArr);
				this.addPage = Number(val);
			},
			handleSizeChange11(val) {
				this.addPageSize11 = val;
			},
			handleCurrentChange11(val) {
				//console.log(this.selectArr);
				this.addPage11 = Number(val);
			},
			handleSizeChange22(val) {
				this.addPageSize22 = val;
			},
			handleCurrentChange22(val) {
				//console.log(this.selectArr);
				this.addPage22 = Number(val);
			},
			handleSizeChange33(val) {
				this.addPageSize33 = val;
			},
			handleCurrentChange33(val) {
				//console.log(this.selectArr);
				this.addPage33 = Number(val);
			},
			handleSizeChange44(val) {
				this.addPageSize44 = val;
			},
			handleCurrentChange44(val) {
				//console.log(this.selectArr);
				this.addPage44 = Number(val);
			},
			handleRemove(file, fileList) {
				//console.log(file, fileList);
			},
			handlePreview(file) {
				//console.log(file);
			},
			beforeRemove(file, fileList) {
				return this.$confirm(`确定移除 ${ file.name }？`);
			},
			handleAvatarSuccess(res, file) {
				//console.log(1);
				this.imageUrl = URL.createObjectURL(file.raw);
			},
			beforeAvatarUpload(file) {
				const isJPG = file.type === 'image/jpeg';
				const isLt2M = file.size / 1024 / 1024 < 2;
				if(!isJPG) {
					this.$message.error('上传头像图片只能是 JPG 格式!');
				}
				if(!isLt2M) {
					this.$message.error('上传头像图片大小不能超过 2MB!');
				}
				return isJPG && isLt2M;
			},
			//当天次数限制
			handleChange4(value) {
				//console.log(value);
			},
			//添加商品
			add_goods1() {
				this.getServData;
				this.addDialog1 = true;
			},
			add_goods11() {
				this.getServData11;
				this.addDialog11 = true;
			},
			add_goods22() {
				this.getServData22;
				this.addDialog22 = true;
			},
			add_goods33() {
				this.getServData33;
				this.addDialog33 = true;
			},
			add_goods44() {
				this.getServData44;
				this.addDialog44 = true;
			},
			//清空商品
			empty_goods1() {
				this.tableDatas1 = [];
			},
			empty_goods11() {
				this.tableDatas11 = [];
			},
			empty_goods22() {
				this.tableDatas11 = [];
			},
			empty_goods33() {
				this.tableDatas11 = [];
			},
			empty_goods44() {
				this.tableDatas11 = [];
			},
			//编辑中的删除
			editDel(id, idd) {
				for(let i = 0; i < this.tableDatas1.length; i++) {
					if(this.tableDatas1[i].SERV_ID == id) {
						this.tableDatas1.splice(i, 1);
					}
				}
				deleteCafeActivityGoods(idd).then(res => {
					if(res.data.STATUS_CODE === 1) {
						this.getI();
					}
				})
			},
			editDel11(id, idd) {
				for(let i = 0; i < this.tableDatas11.length; i++) {
					if(this.tableDatas11[i].SERV_ID == id) {
						this.tableDatas11.splice(i, 1);
					}
				}
				deleteCafeActivityGoods(idd).then(res => {
					if(res.data.STATUS_CODE === 1) {
						this.getI();
					}
				})
			},
			editDel22(id, idd) {
				for(let i = 0; i < this.tableDatas22.length; i++) {
					if(this.tableDatas22[i].SERV_ID == id) {
						this.tableDatas22.splice(i, 1);
					}
				}
				deleteCafeActivityGoods(idd).then(res => {
					if(res.data.STATUS_CODE === 1) {
						this.getI();
					}
				})
			},
			editDel33(id, idd) {
				for(let i = 0; i < this.tableDatas33.length; i++) {
					if(this.tableDatas33[i].SERV_ID == id) {
						this.tableDatas33.splice(i, 1);
					}
				}
				deleteCafeActivityGoods(idd).then(res => {
					if(res.data.STATUS_CODE === 1) {
						this.getI();
					}
				})
			},
			editDel44(id, idd) {
				for(let i = 0; i < this.tableDatas44.length; i++) {
					if(this.tableDatas44[i].SERV_ID == id) {
						this.tableDatas44.splice(i, 1);
					}
				}
				deleteCafeActivityGoods(idd).then(res => {
					if(res.data.STATUS_CODE === 1) {
						this.getI();
					}
				})
			},
			//编辑中的完成
			editFinished() {
				//console.log(this.tableDatas1);
				this.editDialog1 = false;
			},
			editFinished11() {
				//console.log(this.tableDatas11);
				this.editDialog11 = false;
			},
			editFinished22() {
				//console.log(this.tableDatas22);
				this.editDialog22 = false;
			},
			editFinished33() {
				//console.log(this.tableDatas33);
				this.editDialog33 = false;
			},
			editFinished44() {
				//console.log(this.tableDatas44);
				this.editDialog44 = false;
			},
			//添加商品select
			handleSelectionChange2(val) {
				this.selectArr = val;
				//console.log(this.selectArr);
			},
			handleSelectionChange11(val) {
				this.selectArr11 = val;
				//console.log(this.selectArr);
			},
			handleSelectionChange22(val) {
				this.selectArr22 = val;
				//console.log(this.selectArr);
			},
			handleSelectionChange33(val) {
				this.selectArr33 = val;
				//console.log(this.selectArr);
			},
			handleSelectionChange44(val) {
				this.selectArr44 = val;
				//console.log(this.selectArr);
			},
			//添加商品加入
			add2() {
				if(this.selectArr.length == 0) {
					this.$alert('请选择商品', '提示', {
						confirmButtonText: '确定',
					});
					return;
				}
				this.tableDatas1 = this.selectArr;
				this.addDialog1 = false;
			},
			add11() {
				if(this.selectArr11.length == 0) {
					this.$alert('请选择商品', '提示', {
						confirmButtonText: '确定',
					});
					return;
				}
				this.tableDatas11 = this.selectArr11;
				this.addDialog11 = false;
			},
			add22() {
				if(this.selectArr22.length == 0) {
					this.$alert('请选择商品', '提示', {
						confirmButtonText: '确定',
					});
					return;
				}
				this.tableDatas22 = this.selectArr22;
				this.addDialog22 = false;
			},
			add33() {
				if(this.selectArr33.length == 0) {
					this.$alert('请选择商品', '提示', {
						confirmButtonText: '确定',
					});
					return;
				}
				this.tableDatas33 = this.selectArr33;
				this.addDialog33 = false;
			},
			add44() {
				if(this.selectArr44.length == 0) {
					this.$alert('请选择商品', '提示', {
						confirmButtonText: '确定',
					});
					return;
				}
				this.tableDatas44 = this.selectArr44;
				this.addDialog44 = false;
			},
			//自动点击
			autoClick() {
				document.getElementById("upfile").click();
			},
			//上传文件
			onFileChange($event) {
				//console.log($event);
				if($event.target.files.length == 0) {
					return;
				}
				//图片预览fileReader
				let fr = new FileReader();
				fr.readAsDataURL($event.target.files[0]);
				let that = this;
				let sImg = document.getElementById('showImg');
				fr.onload = function(evt) {
					//console.log(evt);					
					sImg.src = evt.target.result;
					that.imgU = evt.target.result.split(',')[1];
				}
				//console.log(that.imgU);
			},
			//提交
			submits() {
				if(this.value3 === null){
                	this.value3 = '';
                }
				if(this.input1 == '') {
					this.$alert('请输入营销名称', '提示', {
						confirmButtonText: '确定',
					});
					return;
				}
				if(this.imgU[1] == '') {
					this.$alert('请上传图片', '提示', {
						confirmButtonText: '确定',
					});
					return;
				}
				if(this.value1 == '') {
					this.$alert('请选择适用门店', '提示', {
						confirmButtonText: '确定',
					});
					return;
				}
				if(this.value2 == '') {
					this.$alert('请选择营销类型', '提示', {
						confirmButtonText: '确定',
					});
					return;
				}
				if(this.value3.length == 0) {
					this.$alert('请选择有效日期', '提示', {
						confirmButtonText: '确定',
					});
					return;
				}
				if(this.value7.length == 0) {
					this.$alert('请选择适用等级', '提示', {
						confirmButtonText: '确定',
					});
					return;
				}
				if(this.value9.length == 0) {
					this.$alert('请选择营销周期', '提示', {
						confirmButtonText: '确定',
					});
					return;
				}
				if(this.checkboxGroup.length == 0) {
					this.$alert('请至少选择一个周期', '提示', {
						confirmButtonText: '确定',
					});
					return;
				}
				let one_one = [],
					one_two = [],
					two_one = [],
					two_two = [],
					two_three = [],
					new_act1 = [],
					new_act2 = [];
				let obj = {};
				let postObj = {};
				obj.CAFE_ACTIVITY_Id = this.$route.params.id; //营销ID；修改时必传
				obj.ACTIVITY_NAME = this.input1; //营销名称
				obj.ACTIVITY_PHOTO = this.imgU; //营销图片
				obj.COMP_ID = this.value1; //商铺唯一标识
				obj.ACT_TYPE = this.value2; //营销类型 ：4180228:买一送一      4180225:买二送一
				obj.START_TIME = this.value3[0].getTime(); //开始时间
				obj.END_TIME = this.value3[1].getTime(); //结束时间
				obj.USER_GRADE = this.value7.join(','); //可使用等级；多个等级以“,”隔开
				obj.BUY_NUM = this.value8; //可购买数量
				obj.PERIOD_TYPE = this.value9; //营销模式：传“1”：按周促销
				obj.WEEK = this.checkboxGroup.join(','); //周期；多个周期以“,”隔开       	
				//-----------------营销商品列表数据封装start----------------------
				if(this.value2 == 4180228) { //买一送一      		      		
					if(this.tableDatas1.length > 0) { //第一杯      			
						one_one = JSON.parse(JSON.stringify(this.tableDatas1));
						for(let i = 0; i < one_one.length; i++) {
							this.$delete(one_one[i], 'ATTR_LIST');
							this.$delete(one_one[i], 'ATTR_NAME_LIST');
							this.$delete(one_one[i], 'CLASS_NAME');
							this.$delete(one_one[i], 'PRICE');
							this.$delete(one_one[i], 'SERV_NAME');
							this.$set(one_one[i], 'GOODS_TYPE', 1);
							this.$set(one_one[i], 'IS_CHARGE', 0);
						}
					}
					if(this.tableDatas11.length > 0) { //第二杯      			
						one_two = JSON.parse(JSON.stringify(this.tableDatas11));
						for(let i = 0; i < one_two.length; i++) {
							this.$delete(one_two[i], 'ATTR_LIST');
							this.$delete(one_two[i], 'ATTR_NAME_LIST');
							this.$delete(one_two[i], 'CLASS_NAME');
							this.$delete(one_two[i], 'PRICE');
							this.$delete(one_two[i], 'SERV_NAME');
							this.$set(one_two[i], 'GOODS_TYPE', 2);
							this.$set(one_two[i], 'IS_CHARGE', 1);
						}
					}
					new_act1 = one_one.concat(one_two);
					postObj = qs.stringify(obj);
					//console.log(postObj);
					//营销商品列表
					postObj += "&CAFE_ACTIVITY_GOODS=" + JSON.stringify(new_act1);
				} else if(this.value2 == 4180225) { //买二送一      		
					if(this.tableDatas22.length > 0) { //第一杯
						two_one = JSON.parse(JSON.stringify(this.tableDatas22));
						for(let i = 0; i < two_one.length; i++) {
							this.$delete(two_one[i], 'ATTR_LIST');
							this.$delete(two_one[i], 'ATTR_NAME_LIST');
							this.$delete(two_one[i], 'CLASS_NAME');
							this.$delete(two_one[i], 'PRICE');
							this.$delete(two_one[i], 'SERV_NAME');
							this.$set(two_one[i], 'GOODS_TYPE', 1);
							this.$set(two_one[i], 'IS_CHARGE', 0);
						}
					}
					if(this.tableDatas33.length > 0) { //第二杯
						two_two = JSON.parse(JSON.stringify(this.tableDatas33));
						for(let i = 0; i < two_two.length; i++) {
							this.$delete(two_two[i], 'ATTR_LIST');
							this.$delete(two_two[i], 'ATTR_NAME_LIST');
							this.$delete(two_two[i], 'CLASS_NAME');
							this.$delete(two_two[i], 'PRICE');
							this.$delete(two_two[i], 'SERV_NAME');
							this.$set(two_two[i], 'GOODS_TYPE', 2);
							this.$set(two_two[i], 'IS_CHARGE', 0);
						}
					}
					if(this.tableDatas44.length > 0) { //第三杯
						two_three = JSON.parse(JSON.stringify(this.tableDatas44));
						for(let i = 0; i < two_three.length; i++) {
							this.$delete(two_three[i], 'ATTR_LIST');
							this.$delete(two_three[i], 'ATTR_NAME_LIST');
							this.$delete(two_three[i], 'CLASS_NAME');
							this.$delete(two_three[i], 'PRICE');
							this.$delete(two_three[i], 'SERV_NAME');
							this.$set(two_three[i], 'GOODS_TYPE', 3);
							this.$set(two_three[i], 'IS_CHARGE', 1);
						}
					}
					new_act2 = two_one.concat(two_two, two_three);
					postObj = qs.stringify(obj);
					//console.log(postObj);
					//营销商品列表
					postObj += "&CAFE_ACTIVITY_GOODS=" + JSON.stringify(new_act2);
				}
				//防止重复提交				
				let flagss = true;
				if(flagss) {
					axios({
						url: window.getIps + '/4SCAFE/CafeActivitySystem/addCafeActivity.action',
						method: 'post',
						headers: {
							'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
						},
						dateType: 'json',
						data: postObj
					}).then(res => {
						//console.log(res);
						flagss = false;
						if(res.data.STATUS_CODE == 1) {
							flagss = true;
							this.$message({
								type: 'success',
								message: '修改成功'
							});
							setTimeout(() => this.$router.push({
								path: '/functions/market'
							}), 1500);
						}
					})
				}
			},
			//取消
			cancels() {
				this.$confirm('此操作将不会保存信息, 是否继续?', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					this.$router.push({
						path: '/functions/market'
					});
				}).catch(() => {
					this.$message({
						type: 'info',
						message: '已取消操作'
					});
				});
			},
			//第一杯（买一送一）
			first_b() {
				if(this.value1 == '') {
					this.$alert('请选择适用门店', '提示', {
						confirmButtonText: '确定',
					});
					return;
				}
				for(let i = 0; i < this.options1.length; i++) {
					if(this.options1[i].COMP_ID == this.value1) {
						this.shopName1 = this.options1[i].SHOP_NAME;
					}
				}
				this.editDialog1 = true;
				let objj = {};
				objj.CAFE_ACTIVITY_ID = this.$route.params.id;
				objj.GOODS_TYPE = 1;
				getCafeActivityGoodsByCafeActivityId(objj).then(res => {
					if(res.data.STATUS_CODE === 1) {
						this.tableDatas1 = res.data.SERV_LIST;
					}
				})
			},
			//第二杯（买一送一）
			second_b() {
				if(this.value1 == '') {
					this.$alert('请选择适用门店', '提示', {
						confirmButtonText: '确定',
					});
					return;
				}
				for(let i = 0; i < this.options1.length; i++) {
					if(this.options1[i].COMP_ID == this.value1) {
						this.shopName11 = this.options1[i].SHOP_NAME;
					}
				}
				this.editDialog11 = true;
				let objj = {};
				objj.CAFE_ACTIVITY_ID = this.$route.params.id;
				objj.GOODS_TYPE = 2;
				getCafeActivityGoodsByCafeActivityId(objj).then(res => {
					if(res.data.STATUS_CODE === 1) {
						this.tableDatas11 = res.data.SERV_LIST;
					}
				})
			},
			//第一杯（买二送一）
			first_bb() {
				if(this.value1 == '') {
					this.$alert('请选择适用门店', '提示', {
						confirmButtonText: '确定',
					});
					return;
				}
				for(let i = 0; i < this.options1.length; i++) {
					if(this.options1[i].COMP_ID == this.value1) {
						this.shopName22 = this.options1[i].SHOP_NAME;
					}
				}
				this.editDialog22 = true;
				let objj = {};
				objj.CAFE_ACTIVITY_ID = this.$route.params.id;
				objj.GOODS_TYPE = 1;
				getCafeActivityGoodsByCafeActivityId(objj).then(res => {
					if(res.data.STATUS_CODE === 1) {
						this.tableDatas22 = res.data.SERV_LIST;
					}
				})
			},
			//第二杯（买二送一）
			second_bb() {
				if(this.value1 == '') {
					this.$alert('请选择适用门店', '提示', {
						confirmButtonText: '确定',
					});
					return;
				}
				for(let i = 0; i < this.options1.length; i++) {
					if(this.options1[i].COMP_ID == this.value1) {
						this.shopName33 = this.options1[i].SHOP_NAME;
					}
				}
				this.editDialog33 = true;
				let objj = {};
				objj.CAFE_ACTIVITY_ID = this.$route.params.id;
				objj.GOODS_TYPE = 2;
				getCafeActivityGoodsByCafeActivityId(objj).then(res => {
					if(res.data.STATUS_CODE === 1) {
						this.tableDatas33 = res.data.SERV_LIST;
					}
				})
			},
			//第三杯（买二送一）
			third_bb() {
				if(this.value1 == '') {
					this.$alert('请选择适用门店', '提示', {
						confirmButtonText: '确定',
					});
					return;
				}
				for(let i = 0; i < this.options1.length; i++) {
					if(this.options1[i].COMP_ID == this.value1) {
						this.shopName44 = this.options1[i].SHOP_NAME;
					}
				}
				this.editDialog44 = true;
				let objj = {};
				objj.CAFE_ACTIVITY_ID = this.$route.params.id;
				objj.GOODS_TYPE = 3;
				getCafeActivityGoodsByCafeActivityId(objj).then(res => {
					if(res.data.STATUS_CODE === 1) {
						this.tableDatas44 = res.data.SERV_LIST;
					}
				})
			},
			//格式化（时间戳转时间）
			formats(val) {
				let y = new Date(val).getFullYear();
				let m = new Date(val).getMonth() + 1 >= 10 ? new Date(val).getMonth() + 1 : '0' + (new Date(val).getMonth() + 1);
				let d = new Date(val).getDate() >= 10 ? new Date(val).getDate() : '0' + new Date(val).getDate();
				let h = new Date(val).getHours() >= 10 ? new Date(val).getHours() : '0' + new Date(val).getHours();
				let ms = new Date(val).getMinutes() >= 10 ? new Date(val).getMinutes() : '0' + new Date(val).getMinutes();
				let s = new Date(val).getSeconds() >= 10 ? new Date(val).getSeconds() : '0' + new Date(val).getSeconds();
				return y + "-" + m + "-" + d + " " + h + ":" + ms + ":" + s;
			},
			//数组里的字符串转数字
			arrNum(arr) {
				for(let i = 0; i < arr.length; i++) {
					if(arr[i] == Number(arr[i])) {
						arr[i] = Number(arr[i]);
					}
				}
			},
		},
	}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
	.el-button {
		margin: 0 15px;
	}
	.dialog_table2 {
		.el-pagination {
			text-align: center;
			margin-top: 30px;
		}
	}
	/* 上传样式start */
	
	.avatar-uploader .el-upload {
		border: 1px dashed #d9d9d9;
		border-radius: 6px;
		cursor: pointer;
		position: relative;
		overflow: hidden;
	}
	.avatar-uploader .el-upload:hover {
		border-color: #409EFF;
	}
	.avatar-uploader-icon {
		font-size: 28px;
		color: #8c939d;
		width: 90px;
		height: 90px;
		line-height: 90px;
		text-align: center;
		border: 1px dashed #d9d9d9;
		border-radius: 6px;
	}
	.avatar {
		width: 90px;
		height: 90px;
		display: block;
	}
	/* 上传样式end */
	
	.add_market {
		header {
			background: #fff;
			font-size: 22px;
			font-weight: 700;
			padding: 20px;
		}
		.form_contents {
			padding-bottom: 40px;
			p {
				white-space: nowrap;
				width: 150px;
				text-align: right;
			}
			width:97%;
			margin:25px auto;
			background:#fff;
			padding-top:40px;
			.common {
				width: 50%;
				margin: 26px auto;
				display: flex;
				align-items: center;
			}
			.first_b, .second_b, .third_b {
				img {
					width: 22px;
					height: 22px;
					cursor: pointer;
					margin-left: 10px;
				}
			}
			.market_name {
				width: 50%;
			}
			.upload_img {
				align-items: flex-start;
				.up_imgs {
					display: flex;
				}
			}
			.weekdays {
				width: 33%;
			}
			.buttons {
				width: 34.8%;
			}
		}
		.dialog_btns1 {
			width: 100%;
			border-top: 1px solid #f0f0f0;
			display: flex;
			padding-top: 26px;
		}
		.have_add1 {
			width: 98%;
			margin: 30px auto 15px auto;
			border: 1px solid #f0f0f0;
			border-radius: 5px;
			background: #fafafa;
			p {
				display: flex;
				align-items: center;
				img {
					width: 20px;
					height: 20px;
					margin: 0 10px;
				}
				span {
					font-size: 16px;
					color: #717a7d;
					label {
						color: #e7251a;
					}
				}
			}
		}
		.dialog_table1 {
			width: 98%;
			margin: 0 auto;
			margin-bottom: 40px;
			.delete1 {
				color: #1d93ff;
				cursor: pointer;
				&:hover {
					text-decoration: underline;
				}
			}
		}
	}
	.innerDialog {
		margin-top: -60px;
		.dialog_condition1 {
			display: flex;
			align-items: center;
			justify-content: center;
			white-space: nowrap;
			margin: 0 auto;
			box-sizing: border-box;
			padding-bottom: 40px;
			padding-left: 15%;
			border-bottom: 1px solid #f0f0f0;
			.dialog_select1, .dialog_input1 {
				width: 250px;
			}
		}
		.dialog_btns2 {
			display: flex;
			justify-content: flex-end;
			padding: 30px 0;
		}
	}
</style>